home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK1.toast / Development Kits (Disc 1) / Interfaces & Libraries / Interfaces / CIncludes / ImageCodec.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-01  |  12.6 KB  |  349 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ImageCodec.h
  3.  
  4.      Contains:    QuickTime interfaces
  5.  
  6.      Version:    Technology:    Technology:    QuickTime 2.5
  7.                  Package:    Universal Interfaces 2.1.3
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __IMAGECODEC__
  19. #define __IMAGECODEC__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __QDOFFSCREEN__
  28. #include <QDOffscreen.h>
  29. #endif
  30. #ifndef __WINDOWS__
  31. #include <Windows.h>
  32. #endif
  33. #ifndef __IMAGECOMPRESSION__
  34. #include <ImageCompression.h>
  35. #endif
  36. #ifndef __COMPONENTS__
  37. #include <Components.h>
  38. #endif
  39. #ifndef __MOVIES__
  40. #include <Movies.h>
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT_SUPPORTED
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_ALIGN_SUPPORTED
  52. #pragma options align=mac68k
  53. #endif
  54.  
  55. /*    codec capabilities flags    */
  56.  
  57. enum {
  58.     codecCanScale                = 1L << 0,
  59.     codecCanMask                = 1L << 1,
  60.     codecCanMatte                = 1L << 2,
  61.     codecCanTransform            = 1L << 3,
  62.     codecCanTransferMode        = 1L << 4,
  63.     codecCanCopyPrev            = 1L << 5,
  64.     codecCanSpool                = 1L << 6,
  65.     codecCanClipVertical        = 1L << 7,
  66.     codecCanClipRectangular        = 1L << 8,
  67.     codecCanRemapColor            = 1L << 9,
  68.     codecCanFastDither            = 1L << 10,
  69.     codecCanSrcExtract            = 1L << 11,
  70.     codecCanCopyPrevComp        = 1L << 12,
  71.     codecCanAsync                = 1L << 13,
  72.     codecCanMakeMask            = 1L << 14,
  73.     codecCanShift                = 1L << 15,
  74.     codecCanAsyncWhen            = 1L << 16,
  75.     codecCanShieldCursor        = 1L << 17,
  76.     codecCanManagePrevBuffer    = 1L << 18,
  77.     codecHasVolatileBuffer        = 1L << 19,
  78.     codecWantsRegionMask        = 1L << 20,
  79.     codecImageBufferIsOnScreen    = 1L << 21,
  80.     codecWantsDestinationPixels    = 1L << 22
  81. };
  82.  
  83. struct CodecCapabilities {
  84.     long                             flags;
  85.     short                             wantedPixelSize;
  86.     short                             extendWidth;
  87.     short                             extendHeight;
  88.     short                             bandMin;
  89.     short                             bandInc;
  90.     short                             pad;
  91.     unsigned long                     time;
  92. };
  93. typedef struct CodecCapabilities CodecCapabilities;
  94.  
  95. /*    codec condition flags    */
  96.  
  97. enum {
  98.     codecConditionFirstBand        = 1L << 0,
  99.     codecConditionLastBand        = 1L << 1,
  100.     codecConditionFirstFrame    = 1L << 2,
  101.     codecConditionNewDepth        = 1L << 3,
  102.     codecConditionNewTransform    = 1L << 4,
  103.     codecConditionNewSrcRect    = 1L << 5,
  104.     codecConditionNewMask        = 1L << 6,
  105.     codecConditionNewMatte        = 1L << 7,
  106.     codecConditionNewTransferMode = 1L << 8,
  107.     codecConditionNewClut        = 1L << 9,
  108.     codecConditionNewAccuracy    = 1L << 10,
  109.     codecConditionNewDestination = 1L << 11,
  110.     codecConditionFirstScreen    = 1L << 12,
  111.     codecConditionDoCursor        = 1L << 13,
  112.     codecConditionCatchUpDiff    = 1L << 14,
  113.     codecConditionMaskMayBeChanged = 1L << 15,
  114.     codecConditionToBuffer        = 1L << 16,
  115.     codecConditionCodecChangedMask = 1L << 31
  116. };
  117.  
  118.  
  119. enum {
  120.     codecInfoResourceType        = 'cdci',                        /* codec info resource type */
  121.     codecInterfaceVersion        = 2                                /* high word returned in component GetVersion */
  122. };
  123.  
  124. struct CDSequenceDataSource {
  125.     long                             recordSize;
  126.  
  127.     void *                            next;
  128.  
  129.     ImageSequence                     seqID;
  130.     ImageSequenceDataSource         sourceID;
  131.     OSType                             sourceType;
  132.     long                             sourceInputNumber;
  133.     void *                            dataPtr;
  134.     Handle                             dataDescription;
  135.     long                             changeSeed;
  136.     ICMConvertDataFormatUPP         transferProc;
  137.     void *                            transferRefcon;
  138.     long                             dataSize;
  139. };
  140. typedef struct CDSequenceDataSource CDSequenceDataSource;
  141.  
  142. typedef CDSequenceDataSource *CDSequenceDataSourcePtr;
  143. struct CodecCompressParams {
  144.     ImageSequence                     sequenceID;                    /* precompress,bandcompress */
  145.     ImageDescriptionHandle             imageDescription;            /* precompress,bandcompress */
  146.     Ptr                             data;
  147.     long                             bufferSize;
  148.     long                             frameNumber;
  149.     long                             startLine;
  150.     long                             stopLine;
  151.     long                             conditionFlags;
  152.     CodecFlags                         callerFlags;
  153.     CodecCapabilities *                capabilities;                /* precompress,bandcompress */
  154.     ICMProgressProcRecord             progressProcRecord;
  155.     ICMCompletionProcRecord         completionProcRecord;
  156.     ICMFlushProcRecord                 flushProcRecord;
  157.  
  158.     PixMap                             srcPixMap;                    /* precompress,bandcompress */
  159.     PixMap                             prevPixMap;
  160.     CodecQ                             spatialQuality;
  161.     CodecQ                             temporalQuality;
  162.     Fixed                             similarity;
  163.     DataRateParamsPtr                 dataRateParams;
  164.     long                             reserved;
  165.  
  166.                                                                 /* The following fields only exist for QuickTime 2.1 and greater */
  167.     UInt16                             majorSourceChangeSeed;
  168.     UInt16                             minorSourceChangeSeed;
  169.     CDSequenceDataSourcePtr         sourceData;
  170. };
  171. typedef struct CodecCompressParams CodecCompressParams;
  172.  
  173. struct CodecDecompressParams {
  174.     ImageSequence                     sequenceID;                    /* predecompress,banddecompress */
  175.     ImageDescriptionHandle             imageDescription;            /* predecompress,banddecompress */
  176.     Ptr                             data;
  177.     long                             bufferSize;
  178.     long                             frameNumber;
  179.     long                             startLine;
  180.     long                             stopLine;
  181.     long                             conditionFlags;
  182.     CodecFlags                         callerFlags;
  183.     CodecCapabilities *                capabilities;                /* predecompress,banddecompress */
  184.     ICMProgressProcRecord             progressProcRecord;
  185.     ICMCompletionProcRecord         completionProcRecord;
  186.     ICMDataProcRecord                 dataProcRecord;
  187.  
  188.     CGrafPtr                         port;                        /* predecompress,banddecompress */
  189.     PixMap                             dstPixMap;                    /* predecompress,banddecompress */
  190.     BitMapPtr                         maskBits;
  191.     PixMapPtr                         mattePixMap;
  192.     Rect                             srcRect;                    /* predecompress,banddecompress */
  193.     MatrixRecord *                    matrix;                        /* predecompress,banddecompress */
  194.     CodecQ                             accuracy;                    /* predecompress,banddecompress */
  195.     short                             transferMode;                /* predecompress,banddecompress */
  196.     ICMFrameTimePtr                 frameTime;                    /* banddecompress */
  197.     long                             reserved[1];
  198.                                                                 /* The following fields only exist for QuickTime 2.0 and greater */
  199.     SInt8                             matrixFlags;                /* high bit set if 2x resize */
  200.     SInt8                             matrixType;
  201.     Rect                             dstRect;                    /* only valid for simple transforms */
  202.                                                                 /* The following fields only exist for QuickTime 2.1 and greater */
  203.     UInt16                             majorSourceChangeSeed;
  204.     UInt16                             minorSourceChangeSeed;
  205.     CDSequenceDataSourcePtr         sourceData;
  206.  
  207.     RgnHandle                         maskRegion;
  208.  
  209.                                                                 /* The following fields only exist for QuickTime 2.5 and greater */
  210.  
  211.     OSType **                        wantedDestinationPixelTypes; /* Handle to 0-terminated list of OSTypes */
  212.  
  213.     long                             screenFloodMethod;
  214.     long                             screenFloodValue;
  215.     short                             preferredOffscreenPixelSize;
  216. };
  217. typedef struct CodecDecompressParams CodecDecompressParams;
  218.  
  219.  
  220. enum {
  221.     matrixFlagScale2x            = 1L << 7,
  222.     matrixFlagScale1x            = 1L << 6,
  223.     matrixFlagScaleHalf            = 1L << 5
  224. };
  225.  
  226.  
  227. enum {
  228.     kScreenFloodMethodNone        = 0,
  229.     kScreenFloodMethodKeyColor    = 1,
  230.     kScreenFloodMethodAlpha        = 2
  231. };
  232.  
  233. /*    codec selectors 0-127 are reserved by Apple */
  234. /*    codec selectors 128-191 are subtype specific */
  235. /*    codec selectors 192-255 are vendor specific */
  236. /*    codec selectors 256-32767 are available for general use */
  237. /*    negative selectors are reserved by the Component Manager */
  238. extern pascal ComponentResult ImageCodecGetCodecInfo(ComponentInstance ci, CodecInfo *info)
  239.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0000, 0x7000, 0xA82A);
  240.  
  241. extern pascal ComponentResult ImageCodecGetCompressionTime(ComponentInstance ci, PixMapHandle src, const Rect *srcRect, short depth, CodecQ *spatialQuality, CodecQ *temporalQuality, unsigned long *time)
  242.  FIVEWORDINLINE(0x2F3C, 0x0016, 0x0001, 0x7000, 0xA82A);
  243.  
  244. extern pascal ComponentResult ImageCodecGetMaxCompressionSize(ComponentInstance ci, PixMapHandle src, const Rect *srcRect, short depth, CodecQ quality, long *size)
  245.  FIVEWORDINLINE(0x2F3C, 0x0012, 0x0002, 0x7000, 0xA82A);
  246.  
  247. extern pascal ComponentResult ImageCodecPreCompress(ComponentInstance ci, CodecCompressParams *params)
  248.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0003, 0x7000, 0xA82A);
  249.  
  250. extern pascal ComponentResult ImageCodecBandCompress(ComponentInstance ci, CodecCompressParams *params)
  251.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  252.  
  253. extern pascal ComponentResult ImageCodecPreDecompress(ComponentInstance ci, CodecDecompressParams *params)
  254.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  255.  
  256. extern pascal ComponentResult ImageCodecBandDecompress(ComponentInstance ci, CodecDecompressParams *params)
  257.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  258.  
  259. extern pascal ComponentResult ImageCodecBusy(ComponentInstance ci, ImageSequence seq)
  260.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  261.  
  262. extern pascal ComponentResult ImageCodecGetCompressedImageSize(ComponentInstance ci, ImageDescriptionHandle desc, Ptr data, long bufferSize, ICMDataProcRecordPtr dataProc, long *dataSize)
  263.  FIVEWORDINLINE(0x2F3C, 0x0014, 0x0008, 0x7000, 0xA82A);
  264.  
  265. extern pascal ComponentResult ImageCodecGetSimilarity(ComponentInstance ci, PixMapHandle src, const Rect *srcRect, ImageDescriptionHandle desc, Ptr data, Fixed *similarity)
  266.  FIVEWORDINLINE(0x2F3C, 0x0014, 0x0009, 0x7000, 0xA82A);
  267.  
  268. extern pascal ComponentResult ImageCodecTrimImage(ComponentInstance ci, ImageDescriptionHandle Desc, Ptr inData, long inBufferSize, ICMDataProcRecordPtr dataProc, Ptr outData, long outBufferSize, ICMFlushProcRecordPtr flushProc, Rect *trimRect, ICMProgressProcRecordPtr progressProc)
  269.  FIVEWORDINLINE(0x2F3C, 0x0024, 0x000A, 0x7000, 0xA82A);
  270.  
  271. extern pascal ComponentResult ImageCodecRequestSettings(ComponentInstance ci, Handle settings, Rect *rp, ModalFilterUPP filterProc)
  272.  FIVEWORDINLINE(0x2F3C, 0x000C, 0x000B, 0x7000, 0xA82A);
  273.  
  274. extern pascal ComponentResult ImageCodecGetSettings(ComponentInstance ci, Handle settings)
  275.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  276.  
  277. extern pascal ComponentResult ImageCodecSetSettings(ComponentInstance ci, Handle settings)
  278.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x000D, 0x7000, 0xA82A);
  279.  
  280. extern pascal ComponentResult ImageCodecFlush(ComponentInstance ci)
  281.  FIVEWORDINLINE(0x2F3C, 0x0000, 0x000E, 0x7000, 0xA82A);
  282.  
  283. extern pascal ComponentResult ImageCodecSetTimeCode(ComponentInstance ci, void *timeCodeFormat, void *timeCodeTime)
  284.  FIVEWORDINLINE(0x2F3C, 0x0008, 0x000F, 0x7000, 0xA82A);
  285.  
  286. extern pascal ComponentResult ImageCodecIsImageDescriptionEquivalent(ComponentInstance ci, ImageDescriptionHandle newDesc, Boolean *equivalent)
  287.  FIVEWORDINLINE(0x2F3C, 0x0008, 0x0010, 0x7000, 0xA82A);
  288.  
  289. extern pascal ComponentResult ImageCodecNewMemory(ComponentInstance ci, Ptr *data, Size dataSize, long dataUse, ICMMemoryDisposedUPP memoryGoneProc, void *refCon)
  290.  FIVEWORDINLINE(0x2F3C, 0x0014, 0x0011, 0x7000, 0xA82A);
  291.  
  292. extern pascal ComponentResult ImageCodecDisposeMemory(ComponentInstance ci, Ptr data)
  293.  FIVEWORDINLINE(0x2F3C, 0x0004, 0x0012, 0x7000, 0xA82A);
  294.  
  295. extern pascal ComponentResult ImageCodecHitTestData(ComponentInstance ci, ImageDescriptionHandle desc, void *data, Size dataSize, Point where, Boolean *hit)
  296.  FIVEWORDINLINE(0x2F3C, 0x0014, 0x0013, 0x7000, 0xA82A);
  297.  
  298. extern pascal ComponentResult ImageCodecNewImageBufferMemory(ComponentInstance ci, CodecDecompressParams *params, long flags, ICMMemoryDisposedUPP memoryGoneProc, void *refCon)
  299.  FIVEWORDINLINE(0x2F3C, 0x0010, 0x0014, 0x7000, 0xA82A);
  300.  
  301. extern pascal ComponentResult ImageCodecExtractAndCombineFields(ComponentInstance ci, long fieldFlags, void *data1, long dataSize1, ImageDescriptionHandle desc1, void *data2, long dataSize2, ImageDescriptionHandle desc2, void *outputData, long *outDataSize, ImageDescriptionHandle descOut)
  302.  FIVEWORDINLINE(0x2F3C, 0x0028, 0x0015, 0x7000, 0xA82A);
  303.  
  304. extern pascal ComponentResult ImageCodecGetMaxCompressionSizeWithSources(ComponentInstance ci, PixMapHandle src, const Rect *srcRect, short depth, CodecQ quality, CDSequenceDataSourcePtr sourceData, long *size)
  305.  FIVEWORDINLINE(0x2F3C, 0x0016, 0x0016, 0x7000, 0xA82A);
  306.  
  307.  
  308. /* selectors for component calls */
  309. enum {
  310.     kImageCodecGetCodecInfoSelect                    = 0x0000,
  311.     kImageCodecGetCompressionTimeSelect                = 0x0001,
  312.     kImageCodecGetMaxCompressionSizeSelect            = 0x0002,
  313.     kImageCodecPreCompressSelect                    = 0x0003,
  314.     kImageCodecBandCompressSelect                    = 0x0004,
  315.     kImageCodecPreDecompressSelect                    = 0x0005,
  316.     kImageCodecBandDecompressSelect                    = 0x0006,
  317.     kImageCodecBusySelect                            = 0x0007,
  318.     kImageCodecGetCompressedImageSizeSelect            = 0x0008,
  319.     kImageCodecGetSimilaritySelect                    = 0x0009,
  320.     kImageCodecTrimImageSelect                        = 0x000A,
  321.     kImageCodecRequestSettingsSelect                = 0x000B,
  322.     kImageCodecGetSettingsSelect                    = 0x000C,
  323.     kImageCodecSetSettingsSelect                    = 0x000D,
  324.     kImageCodecFlushSelect                            = 0x000E,
  325.     kImageCodecSetTimeCodeSelect                    = 0x000F,
  326.     kImageCodecIsImageDescriptionEquivalentSelect    = 0x0010,
  327.     kImageCodecNewMemorySelect                        = 0x0011,
  328.     kImageCodecDisposeMemorySelect                    = 0x0012,
  329.     kImageCodecHitTestDataSelect                    = 0x0013,
  330.     kImageCodecNewImageBufferMemorySelect            = 0x0014,
  331.     kImageCodecExtractAndCombineFieldsSelect        = 0x0015,
  332.     kImageCodecGetMaxCompressionSizeWithSourcesSelect = 0x0016
  333. };
  334.  
  335. #if PRAGMA_ALIGN_SUPPORTED
  336. #pragma options align=reset
  337. #endif
  338.  
  339. #if PRAGMA_IMPORT_SUPPORTED
  340. #pragma import off
  341. #endif
  342.  
  343. #ifdef __cplusplus
  344. }
  345. #endif
  346.  
  347. #endif /* __IMAGECODEC__ */
  348.  
  349.